var path= require("path");
var html=require("html-webpack-plugin");
var vueloaderplugin=require("vue-loader/lib/plugin");

module.exports={
        entry:path.join(__dirname,"./src/main.js"),//输入文件
        output:{
            path:path.join(__dirname,"./dist"),//输出文件
            filename:"bundle.js" //文件名
        },
    plugins: [//插件配置节点
        new html({
            template:path.join(__dirname,"./src/index.html"),
            filename:"index.html"
        }),
        //配置vue插件
        new vueloaderplugin()
    ],
    module: {//配置第三方loader 模块的
        rules: [
            {
                //处理css的loader
                test:/\.css$/,use:["style-loader","css-loader"]
            },
            {
                //处理less的loader
                test:/\.less$/,use:["style-loader","css-loader","less-loader"]
            },
            {
                //处理scss的loader
                test:/\.scss$/,use:["style-loader","css-loader","sass-loader" ]
            },
            {
                //处理图片的loader
               // test:/\.jpg|png|gif|bmp|jpeg$/,use:"url-loader?limit=7000&name=[hash:8]-[name].[ext]"
                test: /\.jpg|png|gif|bmp$/, use: 'url-loader?esModule=false&limit=7631&name=[hash:8]-[name].[ext]' 
            },
            {
                //处理字体的loader  
                test:/\.ttf|eot|svg|woff|woff2$/,use:"url-loader",
                //test: /\.ttf|woff|woff2|eot|svg$/, use: 'url-loader' 
            },
            {
                //配置babel处理高级es语法
               // test:/\.js$/,use:"babal-loader", exclude:"/node_modules/"
            },
            {
            
                test:/\.vue$/,use:"vue-loader"
            }
        ]
    },
    resolve:{
       // alias: {//修改vue被导入时候包的路径
            //"vue$":"vue/dist/vue.js"
        //}
    }
};